x86/svm: Reduce vmentry latency
authorAndrew Cooper <andrew.cooper3@citrix.com>
Mon, 10 Feb 2020 11:27:32 +0000 (11:27 +0000)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Mon, 10 Feb 2020 17:42:14 +0000 (17:42 +0000)
commit640330d41e83af8f1b6fbe09a91712e50c411616
treef46bb060ed01747a2e369e61465880a1deabeade
parent40bc1b0c1995cfac0d0da7b9069e944392dafc14
x86/svm: Reduce vmentry latency

Writing to the stack pointer in the middle of a line of pop operations is
specifically recommended against by the optimisation guide, and is a technique
used by Speculative Load Hardening to combat SpectreRSB.

In practice, it causes all further stack-relative accesses to block until the
write to the stack pointer retires, so the stack engine can get back in sync.

Pop into any dead register to discard %rax's value without clobbering the
stack engine.  Smaller compiled code, and runs faster.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
xen/arch/x86/hvm/svm/entry.S